<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a>收件人</a></li>
    </ul>


    <form class="form-horizontal js-ajax-form margin-top-20" action="{:url('setting/receive')}" method="post">
        <div class="form-group">
            <label  class="col-sm-2 control-label"><span class="form-required">*</span>收件人</label>
            <div class="col-md-6 col-sm-10">
            <input class="form-control" type="text" required value="{$info.user_name|default=''}" name="post[user_name]"
                   placeholder="请选择收件人" onclick="doSelectCategory(this);" readonly/>
            <input class="form-control" type="hidden" value="{$info.user_id|default=''}" name="post[user_id]"/>
            </div>
        </div>



        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-primary">保存</button>
            </div>
        </div>
    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
</body>
</html>

<script>
    function doSelectCategory(x) {
        var selectedCategoriesId = $(x).next().val();
        var url="{:url('Task/select')}?ids=" + selectedCategoriesId+"&type="+x.name;
        openIframeLayer(url, '请选择收件人', {
            area: ['700px', '400px'],
            btn: ['确定', '取消'],
            yes: function (index, layero) {
                //do something


                var iframeWin         = window[layero.find('iframe')[0]['name']];

                var re=iframeWin.se();
                console.log(re);
                x.value=re.val;
                $(x).next().val(re.id);
                console.log($(x).next().val());
                //console.log(layer.getFrameIndex(index));
                layer.close(index); //如果设定了yes回调，需进行手工关闭
            }
        });
    }

</script>